package com.fwmagic.spark.streaming.util

import redis.clients.jedis.{Jedis, JedisPool, JedisPoolConfig}

object JedisConnectionPool {

    val config = new JedisPoolConfig()

    config.setMaxTotal(20)
    config.setMaxIdle(10)
    config.setTestOnReturn(true)

    val pool = new JedisPool(config,"192.168.62.131",6379,10000)

    /**
      * 获取Jedis连接
      * @return
      */
    def getConnection():Jedis ={
        pool.getResource
    }

}
